package com.onpositive.page.pagerendering;

import com.onpositive.page.core.NamedLink;
import com.onpositive.storage.managers.AccountManager;

public class EditLinkRenderer {

	public static final String LABEL = "edit page content";
	public static final String SUFFIX = ".edit";

	private NamedLink destLink;

	public EditLinkRenderer(String destURI) {
		destLink = new NamedLink(destURI + SUFFIX, LABEL);
	}

	public String getEditLink() {
		if (AccountManager.isUserLoginned()) {
			StringBuilder sb = new StringBuilder();
			sb.append("<a ");
			sb.append(" href=\"" + destLink.getUrl() + "\">");
			sb.append(destLink.getTitle());
			sb.append("</a>");

			return sb.toString();
		}else{
			return "";
		}
	}
}
